home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COMM.SWG / 0056_Fossil Interrupt.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-25  |  2KB  |  94 lines

  1. {
  2. From: gerhard@loipon.wlink.nl (Gerhard Hoogterp)
  3.  
  4. > > Anyhow, the point is usualy not which fossil is loaded but
  5. > > if there is a fossil at all. And that's what the $1954 result is for.
  6.  
  7. >I now realize that $1954 will be returned for either BNU/X00, but I would
  8. >still like to be able to list to screen "which" fossil has been detected,
  9. >and I cannot seem to figure it out.
  10.  
  11. }
  12. Uses Dos;
  13.  
  14. Const UsePort      = 0;
  15.  
  16. Type InfoArray     = Array[0..255] of Char;
  17.      FossilInfo    = Record
  18.       Size         : Word;        { Record Size         }
  19.       MajVer       : Byte;        { Major Version       }
  20.       MinVer       : Byte;        { Minor Version       }
  21.       IndentPtr    : ^InfoArray;  { Indentifier         }
  22.       InpSize      : Word;        { Size inp. Buffer    }
  23.       InpFree      : Word;        { Free in inp. buffer }
  24.       OutBuf       : Word;        { Size out. Buffer    }
  25.       OutFree      : Word;        { Free in out. Buffer }
  26.       SWidth       : Byte;        { Screen width        }
  27.       SHeight      : Byte;        { Screen height       }
  28.      End;
  29.  
  30. Var Info : FossilInfo;
  31.     C    : Byte;
  32.  
  33. Procedure InitPort(Port : Word);
  34. Var Regs : Registers;
  35. Begin
  36. With Regs Do
  37.  Begin
  38.  AH:=$04;
  39.  DX := Port;
  40.  Intr($14,Regs);
  41.  If AX<>$1954
  42.     Then Halt;
  43.  End;
  44. End;
  45.  
  46.  
  47. Procedure GrabPortInfo(Port : Word);
  48. Var Regs : Registers;
  49. Begin
  50. With Regs Do
  51.  Begin
  52.  AH:=$1B;
  53.  DX:=Port;
  54.  CX:=SizeOf(Info);
  55.  ES:=Seg(Info);
  56.  DI:=Ofs(Info);
  57.  Intr($14,Regs);
  58.  End;
  59. End;
  60.  
  61.  
  62. Procedure DonePort(Port : Word);
  63. Var Regs : Registers;
  64. Begin
  65. With Regs Do
  66.  Begin
  67.  AH:=$05;
  68.  DX:=Port;
  69.  Intr($14,Regs);
  70.  End;
  71. End;
  72.  
  73.  
  74. Begin
  75. FillChar(Info,SizeOf(Info),#00);
  76.  
  77. InitPort(UsePort);
  78. GrabPortInfo(UsePort);
  79.  
  80. WriteLn('Fossil ID:');
  81. Write('  ');
  82.  
  83. C:=0;
  84. While (C<256) And (Info.IndentPtr^[C]<>#00) Do
  85.  Begin
  86.  Write(Info.IndentPtr^[C]);
  87.  Inc(C);
  88.  End;
  89. Writeln;
  90.  
  91. DonePort(UsePort);
  92. End.
  93.  
  94.